using System.Data;
using System.Linq;

namespace Home.Site.Models.DataLayer
{
    public class ReviewTagRepository : IReviewTagRepository
    {
        readonly PromikeDBEntities context = new PromikeDBEntities();

        public IQueryable<ReviewTag> All
        {
            get { return context.ReviewTags; }
        }

        public ReviewTag Find(int id)
        {
            return context.ReviewTags.Find(id);
        }

        public void Insert(ReviewTag reviewtag)
        {
            context.ReviewTags.Add(reviewtag);
            context.SaveChanges();
        }

        public void Update(ReviewTag reviewtag)
        {
            context.Entry(reviewtag).State = EntityState.Modified;
            context.SaveChanges();
        }

        public void Delete(ReviewTag reviewtag)
        {
            context.ReviewTags.Remove(reviewtag);
            context.SaveChanges();
        }
    }
}